package com.bookocean.domain.service.impl;

import com.bookocean.controller.dto.BookDto;
import com.bookocean.controller.dto.BookQuoteDto;
import com.bookocean.domain.dto.BookCoverDto;
import com.bookocean.domain.repository.BookRepository;
import com.bookocean.domain.service.BookDomainService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 书籍领域服务实现类
 * 
 * @author BookOcean
 * @since 2024-01-01
 */
@Service
@RequiredArgsConstructor
public class BookDomainServiceImpl implements BookDomainService {

    private final BookRepository bookRepository;


    @Override
    public BookDto getBookInfoByName(String title) {
        return bookRepository.getBookInfoByName(title);
    }

    @Override
    public List<BookDto> searchBooksByName(String title) {
        return bookRepository.searchBooksByName(title);
    }

    @Override
    public BookDto saveBookInfo(BookDto bookDto) {
        return bookRepository.saveBookInfo(bookDto);
    }

    @Override
    public BookDto getBookById(Long bookId) {
        return bookRepository.getBookById(bookId);
    }

    @Override
    public BookDto getEnhancedBookById(Long bookId, Long userId) {
        return bookRepository.getEnhancedBookById(bookId, userId);
    }

    @Override
    public BookQuoteDto saveQuoteInfo(BookQuoteDto bookQuoteDto) {
        return bookRepository.saveQuoteInfo(bookQuoteDto);
    }

    @Override
    public List<BookQuoteDto> getUserQuotes(Integer page, Integer pageSize, Long userId) {
        return bookRepository.getUserQuotes(page, pageSize, userId);
    }

    @Override
    public BookCoverDto[] getCoversByType(Integer imageType, String userId) {
        return bookRepository.getCoversByType(imageType, userId);
    }

    @Override
    public BookCoverDto saveCover(BookCoverDto coverDto) {
        return bookRepository.saveCover(coverDto);
    }
}
